# MemoryUsage
This is a Blockland DLL to allow TorqueScript to get the memory usage of the current Blockland process.

## Example

Output example:
`2514400000 5`

The function returns the current WorkingSetSize and PrivateUsage as reported by `GetProcessMemoryInfo`.

Storing the function output in a local variable:

```
%m = getMemoryUsage();

//Multiplication by 1 to ensure proper conversion to float of integers over 2^31
%mem = getWord(%m, 0)*1 + getWord(%m, 1)*1;
```

Values over 2^31 (2,147,483,547 or 2GB) can't be properly represented by Torque and must be "converted" to float before handling them.


## Installing
Install RedBlocklandLoader (Eagle517) here: https://gitlab.com/Eagle517/redblocklandloader

Create a "modules" folder in your Blockland folder if you don't have one yet.

Copy "MemoryUsage.dll" (located in the release folder of this project) to the "modules" folder.

## Libraries used (for developers)
All dependencies except MinHook are included. This project is setup (USE\_OWN\_MINHOOK) for the MinHook-export version of RedBlocklandLoader which would cause this project to no longer need MinHook for compilation,
however the MinHook-export version of RBL doesn't yet exist at the time of writing.

MinHook - https://notabug.org/Queuenard/blockland-DLL-MinHook (https://github.com/TsudaKageyu/minhook @ 49d03ad118cf7f6768c79a8f187e14b8f2a07f94)

TSfuncs - https://notabug.org/Queuenard/blockland-DLL-libTSfuncs (derived from https://gitlab.com/Eagle517/tsfuncs)

libBLstructs - https://notabug.org/Queuenard/blockland-DLL-libBLstructs

